define(["jtable"],function(){
	var createTable = function (pid){
		$('#orgTable').jtable({
						title: '组织管理',
						paging: true,
						sorting: true,
						defaultSorting: 'id DESC',
 			            selectingCheckboxes: true, 
 			            openChildAsAccordion: true,
						actions: {
							listAction: '../admin/org/getOrg.json',
//							deleteAction: '../admin/user/deluser.json',
//							updateAction: '../admin/user/modifyuser.json',
							createAction: '../admin/user/createuser.json'
						},
						fields: {
							id: {
								key: true,
								create: false,
								edit: false,
								list: false
							},
							name: {
								title: '名称',
								width: '20%'
							},
							path: {
								title: '路径',
								create: false,
								edit: false,
								width: '20%'
							},
							cn: {
								title: 'CN',
								width: '20%'
							},
							pid: {
								title: 'PID',
								create: false,
								edit: false,
								width: '20%'
							}
							
						}
				});
			$('#orgTable').jtable('load',{pid: pid});
		    $('#LoadRecordsButton').click(function (e) {
		        e.preventDefault();
		        $('#orgTable').jtable('load', {
		        	pid: pid,
		        	username: $('#username').val(),
		            name: $('#name').val()
		        });
		    });
	};
	return {
		createTable: createTable
	};
});